package com.codedancer.campus.manager.api.confessionalWall;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.codedancer.campus.common.anno.InterfacePermission;
import com.codedancer.campus.common.core.BaseApi;
import com.codedancer.campus.common.response.ApiResponse;
import com.codedancer.campus.manager.api.confessionalWall.ro.ConfessionalWallExamineRecordPageSearchRo;
import com.codedancer.campus.manager.api.confessionalWall.ro.ConfessionalWallExamineRecordPageSearchRo;
import com.codedancer.campus.manager.service.IConfessionalWallExamineRecordService;
import com.codedancer.campus.manager.service.IConfessionalWallExamineRecordService;
import com.codedancer.campus.manager.service.bo.confessionalWall.ConfessionalWallExamineRecordPageSearchBo;
import com.codedancer.campus.manager.service.bo.confessionalWall.ConfessionalWallExamineRecordPageSearchBo;
import com.codedancer.campus.manager.service.vo.confessionalWall.ConfessionalWallExamineRecordVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/confessional_wall-examine-record")
@CrossOrigin(methods = {RequestMethod.GET, RequestMethod.POST, RequestMethod.DELETE,
    RequestMethod.PUT}, maxAge = 3600)
@Api(value = "表白墙审核记录Api", description = "表白墙审核记录Api", tags = "表白墙审核记录Api")
public class ConfessionalWallExamineRecordApi extends BaseApi {

    @Autowired
    private IConfessionalWallExamineRecordService confessionalWallExamineRecordService;

    @GetMapping("/page/{confessionalWallUuid}")
    @ApiOperation("分页查询表白墙审核记录")
    @InterfacePermission(encodes = {"superAdmin","confessionalWallAdmin"})
    public ApiResponse<IPage<ConfessionalWallExamineRecordVo>> page(
        @PathVariable(value = "confessionalWallUuid", required = true) @ApiParam(value = "表白墙uuid", required = true) String confessionalWallUuid,
        @ApiParam(value = "表白墙审核记录分页查询Ro", required = false) ConfessionalWallExamineRecordPageSearchRo confessionalWallExamineRecordPageSearchRo) {
        ConfessionalWallExamineRecordPageSearchBo confessionalWallExamineRecordPageSearchBo = BeanUtil
            .copyProperties(confessionalWallExamineRecordPageSearchRo,
                    ConfessionalWallExamineRecordPageSearchBo.class);
        confessionalWallExamineRecordPageSearchBo.setConfessionalWallUuid(confessionalWallUuid);
        return success(confessionalWallExamineRecordService.page(confessionalWallExamineRecordPageSearchBo));
    }
}
